﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LoU.Dungeons
{
    public class Resources : Dictionary<ResourceType, double>
    {
        public double Total { get { return this.Sum(a => a.Value); } }
        public double TotalWithoutGold { get { return this.Where(a => a.Key != ResourceType.Gold).Sum(a => a.Value); } }

        public new double this[ResourceType resource]
        {
            get
            {
                double d;
                if (this.TryGetValue(resource, out d))
                {
                    return d;
                }
                else
                {
                    return 0.0;
                }
            }
            set
            {
                this[resource] = value;
            }
        }
    }
}
